<template>
  <div>
    <el-dialog :modelValue="visiable" title="新增分包商" width="500" @close="$emit('close')">
      <el-form label-width="100px" :inline="false" size="normal">
        <el-form-item label="名称">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="简称">
          <el-input v-model="form.shortName"></el-input>
        </el-form-item>
        <el-form-item label="法人">
          <el-input v-model="form.fr"></el-input>
        </el-form-item>
        <el-form-item label="实际负责人">
          <el-input v-model="form.fr"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">立即创建</el-button>
          <el-button @click="$emit('close')">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script setup lang="ts">
import { reactive } from 'vue'
import useComp from '@renderer/composables/useComp'
import { ElMessage } from 'element-plus'
defineProps(['visiable'])
const emit = defineEmits(['close'])

const { add } = useComp()

const form = reactive({
  name: '湖南鸿诚888888',
  shortName: '湖南鸿诚',
  fr: '王勇',
  sjfzr: '王勇',
})
const onSubmit = async () => {
  await add(form)
  ElMessage({
    message: '分包商添加成功',
    type: 'success',
  })
  emit('close')
}
</script>

<style lang="scss" scoped></style>
